package com.bone.com.service.impl;

import java.util.Date;
import java.util.List;

import com.bone.com.dao.ComLogDAO;
import com.bone.com.po.ComLog;
import com.bone.com.service.ComLogService;

public class ComLogServiceImpl implements ComLogService {

	private ComLogDAO comlogDAO;

	/**
	 * 数据列表.
	 * 
	 * @param parameter
	 * @return
	 */
	public List<ComLog> queryComLogListByParam(ComLog comlog) {
		return this.comlogDAO.queryComLogListByParam(comlog);
	}

	/**
	 * 根据ID取相应的信息.
	 * 
	 * @param para
	 * @return
	 */
	public ComLog queryComLogById(final Long comlogId) {
		return comlogDAO.queryComlogById(comlogId);
	}

	/**
	 * 保存.
	 * 
	 * @param module
	 * @return
	 */
	public boolean saveComlog(ComLog comlog) {
		boolean isSuccess = false;
		comlog.setCreateTime(new Date());
		comlogDAO.insertComlog(comlog);
		isSuccess = true;
		return isSuccess;
	}
	
	/**
	 * 保存.
	 * 
	 * @param module
	 * @return
	 */
	public boolean insertComlog(String objectType,Long objectId,String operatorId,String logType,String logName,String content, String memo) {
		boolean isSuccess = false;
		ComLog comlog = new ComLog();
		comlog.setLogType(logType);
		comlog.setLogName(logName);
		comlog.setObjectType(objectType);
		comlog.setObjectId(objectId);
		comlog.setCreateTime(new Date());
		comlog.setOperatorId(Long.valueOf(operatorId));
		comlog.setContent(content);
		comlog.setMemo(memo);
		comlogDAO.insertComlog(comlog);
		isSuccess = true;
		return isSuccess;
	}
	
  
	/**
	 * 保存.
	 * 
	 * @param module
	 * @return
	 */
	public boolean insertParentComlog(String objectType,Long objectId,Long parentId,String parentType,
			                  String contentType,Long operatorId,String logType,String logName,String content, String memo) {
		boolean isSuccess = false;
		ComLog comlog = new ComLog();
		comlog.setLogType(logType);
		comlog.setLogName(logName);
		comlog.setObjectType(objectType);
		comlog.setObjectId(objectId);
		comlog.setParentId(parentId);
		comlog.setParentType(parentType);
		comlog.setContentType(contentType);
		comlog.setCreateTime(new Date());
		comlog.setOperatorId(operatorId);
		comlog.setContent(content);
		comlog.setMemo(memo);
		comlogDAO.insertComlog(comlog);
		isSuccess = true;
		return isSuccess;
	}
	

	public ComLogDAO getComlogDAO() {
		return comlogDAO;
	}

	public void setComlogDAO(ComLogDAO comlogDAO) {
		this.comlogDAO = comlogDAO;
	}

}
